package cn.car.service.impl;

import cn.car.domains.entity.CameraInfoEntity;
import cn.car.mapper.CameraInfoMapper;
import cn.car.service.CameraService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class CameraServiceImpl implements CameraService {

    @Resource
    private CameraInfoMapper cameraInfoMapper;

    @Override
    public CameraInfoEntity getCameraInfoByIp(String ip) {
        return cameraInfoMapper.getCameraInfoByIp(ip);
    }

    @Override
    public void addCamera(CameraInfoEntity cameraInfoEntity) {
        cameraInfoMapper.insert(cameraInfoEntity);
    }

    @Override
    public CameraInfoEntity getCameraById(Long id) {
        return cameraInfoMapper.selectById(id);
    }

    @Override
    public void updateCamera(CameraInfoEntity cameraInfoEntity) {
        cameraInfoMapper.updateById(cameraInfoEntity);
    }

    @Override
    public void deleteCamera(Long id) {
        cameraInfoMapper.deleteById(id);
    }

    @Override
    public CameraInfoEntity queryByCode(String cameraCode) {
        return cameraInfoMapper.queryByCode(cameraCode);
    }
}
